@echo off & setlocal enabledelayedexpansion

set LIB_JARS=""
cd ..\lib
for %%i in (*) do set LIB_JARS=!LIB_JARS!;..\lib\%%i
cd ..\bin

set MEM_ARGS=-Xms256m -Xmx512m -XX:MaxPermSize=64M
set CLASSPATH=..\conf;%LIB_JARS%;
set SPRINGBOOT_LOADER_PATH=../modules/

if ""%1"" == ""debug"" goto debug
if ""%1"" == ""jmx"" goto jmx

java %MEM_ARGS% -classpath %CLASSPATH% -Dloader.path="%SPRINGBOOT_LOADER_PATH%" org.springframework.boot.loader.PropertiesLauncher
goto end

:debug
java %MEM_ARGS% -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -classpath %CLASSPATH% -Dloader.path="%SPRINGBOOT_LOADER_PATH%" org.springframework.boot.loader.PropertiesLauncher
goto end

:jmx
java %MEM_ARGS% -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -classpath %CLASSPATH% -Dloader.path="%SPRINGBOOT_LOADER_PATH%" org.springframework.boot.loader.PropertiesLauncher

:end
pause